package com.itheima_01;

public class StudentDemo {
    public static void main(String[] args) {
        //对象内存图-单个对象、多个对象
        Student s = new Student();
        System.out.println(s);
        System.out.println(s.name + "  " + s.gender + "  " + s.age + "岁");
        s.name = "阿良";
        s.gender = "男";
        s.age = 25;
        System.out.println(s.name + "  " + s.gender + "  " + s.age + "岁");
        /*System.out.println(s.name);
        System.out.println(s.age);*/
        s.writing();
        s.reading();
        s.playSport();
        System.out.println("----------------");
        Student s1 = new Student();
        System.out.println(s1);
        System.out.println(s1.name + "  " + s1.gender + "  " + s1.age + "岁");
        s1.name = "平安";
        s1.gender = "男";
        s1.age = 24;
        System.out.println(s1.name + "  " + s1.gender + "  " + s1.age + "岁");
        /*System.out.println(s.name);
        System.out.println(s.age);*/
        s1.writing();
        s1.reading();
        s1.playSport();
        System.out.println("------------");
        //对象内存图-多个对象指向相同
        Student s2 = s1;
        System.out.println(s2);
        System.out.println("---修改前---");
        System.out.println(s.name + "  " + s.gender + "  " + s.age + "岁");
        System.out.println(s1.name + "  " + s1.gender + "  " + s1.age + "岁");
        System.out.println(s2.name + "  " + s2.gender + "  " + s2.age + "岁");
        System.out.println("---修改后---");
        s1.name = "天琪";
        s1.gender = "女";
        s1.age = 22;
        System.out.println(s.name + "  " + s.gender + "  " + s.age + "岁");
        System.out.println(s1.name + "  " + s1.gender + "  " + s1.age + "岁");
        System.out.println(s2.name + "  " + s2.gender + "  " + s2.age + "岁");
        /*System.out.println(s.name);
        System.out.println(s.age);*/
        s2.writing();
        s2.reading();
        s2.playSport();
    }
}
